/**
 * File TestReceivedFileModel.java 
 */
package cstest.model;

import static org.junit.Assert.*;

import java.io.File;
import java.net.InetAddress;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import cs.entity.User;
import cs.entity.UserFile;
import cs.entity.UserFile.State;
import cs.model.ReceivedFileModel;

/**
 * Package  cstest.model
 * Project ChatSystemG1 - INSA 4INFOA1 - 2013/2014
 * @author Julie DUMONS & Juste OUEDRAOGO
 *
 */
public class TestReceivedFileModel {

	UserFile uf1, uf2, uf3, uf4 ; 
	ReceivedFileModel rfm1, rfm2 ; 

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
	
		uf1 = new UserFile(new User("username1",InetAddress.getByName("127.0.0.1")), new File("test1.txt")); 
		uf2 = new UserFile(new User("username2",InetAddress.getByName("127.0.0.2")), new File("test2.txt")); 
		uf3 = new UserFile(new User("username3",InetAddress.getByName("127.0.0.3")), new File("test3.txt")); 	
		rfm2 = new ReceivedFileModel();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Test method for {@link cs.model.ReceivedFileModel#ReceivedFileModel()}.
	 */
	@Test
	public void testReceivedFileModel() {
		assertNull(rfm1);
		rfm1 = new ReceivedFileModel() ; 
		assertNotNull(rfm1);
	}

	/**
	 * Test method for {@link cs.model.ReceivedFileModel#addReceivedFile(cs.entity.UserFile)}.
	 */
	@Test
	public void testAddReceivedFile() {
		rfm2.addReceivedFile(uf1);
		
	}

	/**
	 * Test method for {@link cs.model.ReceivedFileModel#setFileState(cs.entity.UserFile, cs.entity.UserFile.State)}.
	 */
	@Test
	public void testSetFileState() {
		rfm2.setFileState(uf1, State.ACCEPTED);
		
	}

	/**
	 * Test method for {@link cs.model.ReceivedFileModel#removeFile(cs.entity.UserFile)}.
	 */
	@Test
	public void testRemoveFile() {
		rfm2.removeFile(uf2);
	}

}
